import React from 'react'
import {bindActionCreators} from 'redux'
import {connect} from 'react-redux'
import {actions} from '../../reducers/index'
import LoginForm from './loginForm'

import './index.less'

class Login extends React.Component {
    render() {
        return(
            <LoginForm 
                login={this.props.login} 
                openid={this.props.openid}
            />)
    }
}

function mapStateToProps(state) {
    return{
        userInfo: state.globalState.userInfo,
        openid: state.globalState.openid
    }
}

function mapDispatchToProps(dispatch) {
    return{
        login: bindActionCreators(actions.get_login, dispatch),
    }
}

export default connect(
    mapStateToProps,
    mapDispatchToProps
)(Login);